
#include "cmock.h"
#include "gmi_spi.h"
#include "gmi_time.h"
#include "stdlib.h"
#include "unity.h"

void setUp(void)
{
    return;
}

void tearDown(void)
{
    return;
}

void test_gmi_time_init()
{
    gmi_time_t* handle = NULL;
    handle             = gmi_time_init();

    TEST_ASSERT(handle != NULL);
    free(handle);
}

void test_gmi_time_deinit()
{
    GMI_STATUS status  = GMI_STATUS_OK;
    gmi_time_t* handle = NULL;

    status = gmi_time_deinit(handle);
    TEST_ASSERT(status != GMI_STATUS_OK);

    handle = gmi_time_init();

    status = gmi_time_deinit(handle);
    TEST_ASSERT(status == GMI_STATUS_OK);
}

void test_gmi_get_tick()
{
    GMI_STATUS status = GMI_STATUS_OK;
    void* handle      = NULL;

    gmi_ts_us_t ts = 0;
    status         = gmi_get_tick(handle, &ts);
    TEST_ASSERT(status != GMI_STATUS_OK);
}

int main(void)
{
    UNITY_BEGIN();

    RUN_TEST(test_gmi_time_init);
    RUN_TEST(test_gmi_get_tick);
    RUN_TEST(test_gmi_time_deinit);

    return UNITY_END();
}
